﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FTBS.Models.DAO;
using FTBS.Models.Entities;

namespace FTBS.Models.BLO
{
    public class ChairBLO
    {
        private ChairDAO _chairDao = new ChairDAO();

        /// <summary>
        /// load chair by rooom Id
        /// </summary>
        /// <param name="roomId"></param>
        /// <returns></returns>
        /// <author>hungph</author>
        public List<Chair> LoadChairs(int roomId)
        {
            var listChair = _chairDao.LoadChairs(roomId);
            return listChair;
        }

        /// <summary>
        /// update chair
        /// </summary>
        /// <param name="listId"></param>
        /// <author>???</author>
        public void UpdateChair(string listId)
        {
            string[] listChair = listId.Split(' ');
            foreach (string chair in listChair)
            {
                _chairDao.UpdateChair(int.Parse(chair));
            }
        }

        /// <summary>
        /// get chair by id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <author>hungph</author>
        public Chair GetChairById(int id)
        {
            var chair = _chairDao.GetChairById(id);
            return chair;
        }
    }
}